package com.mcf.xiaolinju.controller;


import com.mcf.xiaolinju.entity.UserDetails;
import com.mcf.xiaolinju.service.impl.UserDetailsServiceImpl;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mcf
 * @since 2021-10-14
 */
@CrossOrigin
@RestController
@RequestMapping("/xiaolinju/user-details")
public class UserDetailsController {
    @Resource
    UserDetailsServiceImpl userDetailsService;
    //通过用户id查询出用户的详细信息
    @RequestMapping("/getUserDetails")
    public UserDetails getUserDetails(Integer id){

        return  userDetailsService.getmessage(id);
    }
    @RequestMapping("/updateByUserid")
    //通过userid修改表的用户电话号
    public String updateByUserid(int userid,String phonenum,int updateid){
        return userDetailsService.updateByUserid(userid,phonenum,updateid);
    }

    //通过userid查询出用户的身份证号
    @RequestMapping("/getCardId")
    public String getCardId(int id){
        return  userDetailsService.getCardId(id);
    }
    //通过用户名查询出用户的身份证号
    @RequestMapping("getIdNumber")
    public String getIdNumber(String username){
        return  userDetailsService.getIdNumber(username);
    }
    //修改头像
    @RequestMapping("/updateportrait")
    public String updateportrait(String portraiturl, int userid,int updateid){
        return  userDetailsService.updateportrait(portraiturl,userid,updateid);
    }
    //查询头像和小区id
    @RequestMapping("/selectdetailmessage")
    public UserDetails selectdetailmessage(int userid){
        return  userDetailsService.selectdetailmessage(userid);
    }

}
